package features;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextPane;

import utils.*;

public class Format extends Feature{
	
	public Format(JTextPane textPane){
		this.textPane = textPane;
	}
	
	
	public SetFont font = new SetFont();

	
	public void fonT() {
		font.setVisible(true); // setting the visible is true
		font.pack(); // pack the panel
		// making an action for ok button, so we can change the font
		font.getOkjb().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {

				// n.getTextArea().setFont(font.font());
				textPane.setFont(font.font());

				// after we chose the font, then the JDialog will be closed
				font.setVisible(false);
			}
		});
		// making an action for cancel button, so we can return to the old font.
		font.getCajb().addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent ae) {
				// after we cancel the, then the JDialog will be closed
				font.setVisible(false);
			}
		});
	}
}
